package com.trsvax.gwthello.client.gwtui.panel;

import java.util.Iterator;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.ResizeComposite;
import com.google.gwt.user.client.ui.Widget;

public class CategoryPanel extends ResizeComposite implements HasWidgets {
	private static final int ANIMATION_TIME = 250;

	private LayoutPanel layoutPanel;

	public CategoryPanel(Unit unit) {
		initWidget(layoutPanel = new LayoutPanel());
	}

	public void add(Widget w, String header) {
		Label h = new Label(header);
		layoutPanel.add(h);
		layoutPanel.add(w);

		layoutPanel.setWidgetLeftRight(h, 0, Unit.PX, 100, Unit.PX);
		layoutPanel.setWidgetTopHeight(h, 0, Unit.PX, 10, Unit.PX);
		layoutPanel.setWidgetBottomHeight(h, 20, Unit.PX, 20, Unit.PX);
		layoutPanel.setWidgetLeftRight(w, 0, Unit.PX, 100, Unit.PX);

		if (isAttached()) {
			animate(ANIMATION_TIME);
		}
	}

	public void add(Widget w) {
		assert (false);
	}

	public void clear() {
		// TODO Auto-generated method stub

	}

	public Iterator<Widget> iterator() {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean remove(Widget w) {
		// TODO Auto-generated method stub
		return false;
	}

	public void animate(int duration) {
		layoutPanel.animate(duration);
	}

}
